package com.wenwei.sharebox.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.wenwei.sharebox.R;
import com.wenwei.sharebox.base.BaseActivity;
import com.wenwei.sharebox.base.Constant;
import com.wenwei.sharebox.bean.UserShareBean;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2017/07/07 0007.
 */
public class ReturnMoneyActivity extends BaseActivity {
    @Bind(R.id.base_title)
    TextView baseTitle;
    @Bind(R.id.reason_et)
    EditText reasonEt;
    @Bind(R.id.goods_name)
    TextView goodsName;
    @Bind(R.id.goods_image)
    ImageView goodsImage;

    UserShareBean.DataBean bean;
    @Override
    public int setLayoutResourceId() {
        return R.layout.activity_return_money;
    }

    @Override
    protected void init() {
        super.init();
        bean = (UserShareBean.DataBean) getIntent().getSerializableExtra("bean");
    }

    @Override
    protected void initView() {
        super.initView();
        baseTitle.setText("退款");
        goodsName.setText(bean.getShopName());
        Glide.with(mContext).load(bean.getShopImg()).into(goodsImage);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick({R.id.base_back, R.id.sao_tv})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.base_back:
                finish();
                break;
            case R.id.sao_tv:
                if (reasonEt.getText().toString().equals("")) {
                    showToast("您还没有填写退款原因");
                    return;
                }
                Bundle checkBundle = new Bundle();
                checkBundle.putInt("qr_type", Constant.QR_TYPE_RETURN);
                checkBundle.putSerializable("bean", getIntent().getSerializableExtra("bean"));
                checkBundle.putString("reason", reasonEt.getText().toString());
                goActivity(mContext, QRcodeActivity.class, checkBundle);
                break;
        }
    }


}
